# -*- coding : utf-8 -*-
"""
def frec(l1, x, n):
    '''
    frec _ devolve uma lista com n elementos x
    x    _ o elemento a repetir
    n    _ numero de repeticoes
    '''

    if not n:
        return l1
    else:
        return [x] + frec(l1, x, n-1)
    
l2 = frec([], 'BU', 5)
print l2
"""
def factorial(n):
    if n <= 0:
        return 1
    else:
        return n * fatorial(n-1)

def fatorial_cauda(n):
    
    def fact(i = n, acc=1):
        
        if i ==0:
            
            return acc
        else:
            return fact(i-1, (acc * i))
        return fact()
    fatorial_cauda(5)



